/*
 * SVMDuplicateDetector.h
 *
 *  Created on: 2010-8-4
 *      Author: Chengnian Sun.
 */

#ifndef SVMDUPLICATEDETECTOR_H_
#define SVMDUPLICATEDETECTOR_H_

#include "AbstractDuplicateDetector.h"

#include "../feature-vector-calculator/FeatureVectorCalculatorFactory.h"

class SVMToppingAlgorithm;

class SVMDuplicateDetector: public AbstractDuplicateDetector {

private:

  const enum FeatureVectorCalculatorFactory::EnumFeatureCalculatorType m_feature_calculator_type;

  SVMToppingAlgorithm* svm_topping_algorithm;

  const bool m_to_evolve_model;

protected:

  virtual void log_detector_summary(FILE* log_file);

  // should invoke the base::post_detection() first, then update the training set if the duplicate is successfully detected.
  virtual void post_detection(AbstractBugReport& query_report,
      const vector<const MasterBugReport*>& top);

  virtual AbstractToppingAlgorithm* create_topping_algorithm(
      const ReportBuckets& buckets);

  virtual void skip();

public:

  SVMDuplicateDetector(
      FILE* log_file,
      unsigned top_number,
      const ReportDataset& report_dataset,
      const unsigned count_to_skip,
      const vector<IDetectorExtension*>& extensions,
      const enum FeatureVectorCalculatorFactory::EnumFeatureCalculatorType feature_calculator_type,
      const bool to_evolve_model, const bool detecting_all_reports,
      const IndexingType::EnumIndexingType indexing_type);

  virtual ~SVMDuplicateDetector();
};

#endif /* SVMDUPLICATEDETECTOR_H_ */
